//防抖函数
export function debounce (fn, delay) {
    let timer = null;
    return (...e) => {
        let context = this
        let arg = e
        clearTimeout(timer)
        timer = setTimeout(async () => {
          return await fn.apply(context, [...arg])
        }, delay);
    }
}
// 节流函数
export function throttle(fn, delay) {
    let timer = null
    return (...e) => {
        let self = this;
        let args = e;
        if (!timer) {
            timer = setTimeout(async () => {
                return await fn.apply(self, [...args])
            }, delay)
        }
    }
}